package org.nanhill.commons.model.tree;

import java.io.Serializable;
import java.util.List;

/**
 * Tree node, which has one parent at most or not(if this is root node), and has
 * many children or not.
 * 
 * @version 2007-4-5
 * @author xalinx at gmail dot com
 * 
 * @param <E>
 */
public interface TreeNode<E extends TreeNode> extends Serializable {
	/**
	 * Get parent.
	 * 
	 * @return
	 */
	E getParent();

	/**
	 * Get children.
	 * 
	 * @return
	 */
	List<E> getChildren();

	/**
	 * Get path list, contain self, order by parent to child.
	 * 
	 * @return
	 */
	List<E> getPath();

	/**
	 * Get floor number.
	 * 
	 * @param nodeId
	 * @return
	 */
	int getFloor();

	/**
	 * Leaf has no childern and is not root.
	 * 
	 * @return
	 */
	boolean isLeaf();

	/**
	 * Root has no parent.
	 * 
	 * @return
	 */
	boolean isRoot();

}
